(C) 1996 AROS - The Amiga Replacement OS


NAME
#include <proto/iffparse.h>
LONG PushChunk()
SYNOPSIS
struct IFFHandle * iff
LONG type
LONG id
LONG size

LOCATION
In IFFParseBase at offset 14
FUNCTION
Pushes a new context node onto the context stack. Usually used in write mode. In write mode the contextnode will be pushed with the given parameters. In Read mode the type, id and size will be read from the installed stream. Note that IFFSIZE_UNKNOW can be given for size in write mode. In that case, the size of will not be known until you do a PopChunk(). PopChunk() will then seek back in the stream and write the correct size.

INPUTS
iff
pointer to IFFHandle struct.
type
chunk type specifier.
id
chunk identifier.
size
size of the new chunk. May be IFFSIZE_UNKNOWN.
RESULT
error - 0 if successfull, IFFERR_#? otherwize.

NOTES
EXAMPLE
BUGS
SEE ALSO
PopChunk()
INTERNALS
We do different things for Read and Write streams (obviosly enough ;->)

Write: Write the supplied id, size and evt type into the stream.

Read: Get a chunk from disk

For Write mode there are som problems with unknown chunk size and non-random-seekable streams: 4. situations:

SIZE KNOWN && RSEEK - Just write the whole header. SIZE KNOWN && !RSEEK - Write whole header. No RSEEK does not matter, since we don't have to seek back to write size in PopChunk

SIZE UNKNOWN && RSEEK - Write whole header. Write size too, just to seek pass it, even if the size value might be meaningless. We will seek back and insert the correct size later.

SIZE UNKNOWN && !RSEEK - Here is where the trouble starts. We can not seek back and insert the correct size later, which means that we MUST buffer the contents of the chunk, and don't write ANYTHING to the stream until we know its size.

We preserve the old StreamHandler, and inserts a new one that buffers all writes into memory.

HISTORY
13.02.1997 digulla
Bugfix. Loads IFF pictures now.

Added lots of debug output

03.02.1997 digulla
Some major hacks because we don't have A6 - The IFFParseBase must be passed to the hooks in hook->h_Data.
03.02.1997 digulla
Iffparse.library as supplied by Nils H. Lorentzen